
#include "QtGui/QApplication"
#include "QtCore/QString"
#include "QtGui/QLabel"
#include "QtCore/QDebug"
#include "QtCore/QTextStream"
#include "../jncTypeConversion.h"
#include "../jncImportNamespace.h"
#include "qt.h"

class ExpQt : public JncInterface {
  typedef int (*Qtfn)(int, char* []);
  JNCINTERFACEIMPL(ExpQt, Qtfn)
    public:
  gReturnCode ConsQt(jncTypev , jncTypev);
};

int Qtexample(int, char* []);
gReturnCode ExpQt::ConsQt(jncTypev i, jncTypev s) { 
  try {
    return gReturnCode(Qtexample(jint(i), a_p_jchar(s)));
  }catch(boost::bad_any_cast&)
    { throw; }
}

void getQtNamespace() {
  static boost::shared_ptr<ExpQt> exp_qt(new ExpQt());
  exportObjectHandle<ExpQt>(
			    get_pointer(exp_qt),
			    (const char* [JINC_MAX_ARG]){"Qtexample", "int", "p_token", NULL},
			    (jncTypei [JINC_MAX_ARG]){JCMP, JCMP, JCMP},
			    &ExpQt::ConsQt,
			    NORMAL
			    );
}

int Qtexample(int argc, char * argv[])
{
  QApplication myapp(argc, argv);
  QString message;
  QTextStream buf(&message); 
  buf << "Hello, this example uses QT";
  QLabel label(message);
  label.show();
  return myapp.exec();
}
